package com.zlp.boot1;

import com.alibaba.fastjson.JSONObject;
import com.zlp.boot1.convert.UserConvert;
import com.zlp.boot1.entity.RoleDto;
import com.zlp.boot1.entity.UserDto;
import com.zlp.boot1.entity.UserVo;
import org.springframework.beans.BeanUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@SpringBootApplication
@ServletComponentScan
public class Boot1Application {

    public static void main(String[] args) {

        SpringApplication.run(Boot1Application.class, args);


        /*UserDto userDto = initUerDto();
        String s = JSONObject.toJSONString(userDto);
        System.out.println(s);
        UserVo userVo = JSONObject.parseObject(s, UserVo.class);
        System.out.println(userVo);*/
    }

    private static UserDto initUerDto() {
        RoleDto roleDto1 = new RoleDto();
        roleDto1.setId("1-1");
        roleDto1.setName("zlp");
        RoleDto roleDto2 = new RoleDto();
        roleDto2.setId("1-2");
        roleDto2.setName("zxj");
        List<RoleDto> list = new ArrayList<>();
        list.add(roleDto1);
        list.add(roleDto2);
        UserDto userDto = new UserDto();
        userDto.setId("1");
        userDto.setName("zlp");
        userDto.setList(list);
        //userDto.setRole(roleDto1);
        return userDto;
    }


}
